package demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wx
 * Date: 2023-08-04
 * Time: 21:44
 */
class Shape {
    //231
    public void draw() {
        System.out.println("画一个图型");
    }
}

class Triangle extends Shape {
    public void draw() {
        System.out.println("🔺");
    }
}

class Cycle extends Shape {
        public void draw() {
            System.out.println("⚪");
        }
}

class Ret extends Shape {
    @Override
    public void draw() {
        System.out.println("矩形");
    }
}


public class Test {
   /* public void draw fun(Shape shape) {
        shape.draw();
    }*/

    public static void main1(String[] args) {
         /*Shape shape = new Triangle();
    Shape shape1 = new Ret();
    Shape shape2 = new Cycle();*/
        Shape[] shapes = {new Ret(),new Cycle(),new Ret(),new Cycle(),new Cycle(),new Triangle()};

        for (Shape x: shapes) {
            x.draw();
        }
    }


}
